package io.gitee.xyuesheng.day06;

import java.util.Objects;

public class Score {
    private String name;
    private String course;
    private double score;

    public Score(String name, String course, double score) {
        this.name = name;
        this.course = course;
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCourse() {
        return course;
    }

    public void setCourse(String course) {
        this.course = course;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("Score{");
        sb.append("name='").append(name).append('\'');
        sb.append(", course='").append(course).append('\'');
        sb.append(", score=").append(score);
        sb.append('}');
        return sb.toString();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Score score1 = (Score) o;
        return Double.compare(score1.score, score) == 0 &&
                Objects.equals(name, score1.name) &&
                Objects.equals(course, score1.course);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, course, score);
    }
}
